(function($){
    $(document).ready(function() {
        $('.styleswitch').click(function(){
            switchStylestyle(this.getAttribute("data-switchcolor"));
            return false;
        });
        var c = readCookie('style');
        if (c){
            switchStylestyle(c);
        } else{
            var defaultColor = false;
            $('link[rel*=style][title]').each(function(i){
                this.disabled = true;
                defaultColor = this.getAttribute('data-default-color');
                if(defaultColor){
                    this.disabled = false;
                }			
            });
        }
    });
    function switchStylestyle(styleName){
        $('link[rel*=style][title]').each(function(i){
            this.disabled = true;
            if (this.getAttribute('title') == styleName){
                this.disabled = false;
            } 
        });
        createCookie('style', styleName);
    }

    function createCookie(key,name){
        window.localStorage.setItem(key,name);
    }
    function readCookie(key){
        return window.localStorage.getItem(key);
    }
    function eraseCookie(key){
        window.localStorage.removeItem(key);
    }
})(jQuery);
//风格的切换
function skinChange(){
    $targetObj=$("#skin-set");
    if($targetObj.hasClass("active")){
        $targetObj.removeClass("active");
    }else{
        $targetObj.addClass("active");
    }
}

